#pragma once
/*--------------------------------------------------------------------------------
 * Adaptive Intelligence - Foundation Framework Class Library
 * Version 2.00
 * 
 * DNS Start Of Authority Record Structure
 *      Represents a DNS start-of-authority (SOA) record.
 *------------------------------------------------------------------------------*/

/*--------------------------------------------------------------------------------
 * System Imports
 *------------------------------------------------------------------------------*/
#include "stdafx.h"
using namespace System;
using namespace System::Net;

namespace Adaptive
{
	namespace Network
	{
		namespace Dns
		{
			/// <summary>
			/// DNS start of authority (SOA) record.
			/// </summary>
			public value struct DnsStartOfAuthorityRecord
			{
			internal:
				/// <summary>
				/// Initializes a new instance of the class from the unmanaged record.
				/// </summary>
				/// <param name="record"> A pointer to a DNS_RECORD structure whose contents are to be copied.</param>
				DnsStartOfAuthorityRecord(DNS_RECORD* record)
				{
					if (record == NULL)
					{
						PrimaryServer = String::Empty;
						Administrator = String::Empty;
						SerialNo = 0;
						Refresh = 0;
						Retry =0;
						Expire = 0;
						DefaultTtl = 0;
					}
					else
					{
						PrimaryServer = gcnew String (record->Data.SOA.pNamePrimaryServer);
						Administrator = gcnew String (record->Data.SOA.pNameAdministrator);
						SerialNo = record->Data.SOA.dwSerialNo;
						Refresh = record->Data.SOA.dwRefresh;
						Retry =record->Data.SOA.dwRetry;
						Expire = record->Data.SOA.dwExpire;
						DefaultTtl = record->Data.SOA.dwDefaultTtl;
					}
				}
			private:
				/// <summary>
				/// Static constructor.
				/// </summary>
				static DnsStartOfAuthorityRecord()
				{
				}
			public:

				/// <summary>
				/// A string representing the name of the authoritative DNS server for the zone to which the record belongs.
				/// </summary>
				/// <value>
				/// An authoritative DNS server name or empty string.
				/// </value>
				String^ PrimaryServer;  
				/// <summary>
				/// A string representing the name of the responsible party for the zone to which the record belongs.
				/// </summary>
				/// <value>
				/// Responsible party name or empty string.
				/// </value>
				String^ Administrator;  
				/// <summary>
				/// Serial number of the SOA record.
				/// </summary>
				/// <value>
				/// A serial number value, or zero (0).
				/// </value>
				int		SerialNo;  
				/// <summary>
				/// Time, in seconds, before the zone containing this record should be refreshed
				/// </summary>
				/// <value>
				/// Refresh time for the DNS record, in seconds.
				/// </value>
				int		Refresh;  
				/// <summary>
				/// Time, in seconds, before retrying a failed refresh of the zone to which this record belongs.
				/// </summary>
				/// <value>
				/// Retry time for the DNS record, in seconds.
				/// </value>
				int		Retry;  
				/// <summary>
				/// Time, in seconds, before an unresponsive zone is no longer authoritative.
				/// </summary>
				/// <value>
				/// Authority expiration time.
				/// </value>
				int		Expire;  
				/// <summary>
				/// Lower limit on the time, in seconds, that a DNS server or caching resolver are allowed to cache any RRs from the 
				/// zone to which this record belongs.
				/// </summary>
				/// <value>
				/// Default time to live value.
				/// </value>
				int		DefaultTtl;
			};
		}
	}
}